package org.hiucung.orangeppjoke.ui.my;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import org.hiucung.libcommon.utils.StatusBar;
import org.hiucung.orangeppjoke.R;

/**
 * @author Kicc
 * @title: UserBehaviorListActivity
 * @projectName OrangePPJoke
 * @description: TODO
 * @date 2022/1/27 15:03
 */
public class UserBehaviorListActivity extends AppCompatActivity {

    public static final int BEHAVIOR_FAVORITE = 0;
    public static final int BEHAVIOR_HISTORY = 1;

    public static final String KEY_BEHAVIOR = "behavior";

    public static void startBehaviorListActivity(Context context, int behavior) {
        Intent intent = new Intent(context, UserBehaviorListActivity.class);
        intent.putExtra(KEY_BEHAVIOR, behavior);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        StatusBar.fitSystemBar(this);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_layout_list);
        findViewById(R.id.action_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        int result = getIntent().getIntExtra(KEY_BEHAVIOR, BEHAVIOR_FAVORITE);
        TextView title = findViewById(R.id.title);
        title.setText(result == BEHAVIOR_FAVORITE ? "收藏列表":"观看历史列表");

        UserBehaviorListFragment fragment = UserBehaviorListFragment.newInstance(result);
        getSupportFragmentManager().beginTransaction().add(R.id.contanier, fragment, "userBehavior").commit();
    }
}

